import {
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  Length,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateUserDto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({
    description: '用户名',
    required: true,
  })
  name: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '用户密码', required: true })
  password: string;

  @IsString()
  @IsOptional()
  cover: string;

  @IsString()
  @IsOptional()
  sex: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({
    description: '省份',
    required: true,
  })
  province: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({
    required: true,
    description: '城市',
  })
  city: string;

  @IsNumber()
  @IsOptional()
  age: number;

  @IsNotEmpty()
  @IsString()
  @ApiProperty({
    required: true,
    description: '手机号',
  })
  @Length(11)
  phone: string;

  @IsNotEmpty()
  @IsString()
  @ApiProperty({
    description: '用户的角色，可以是 vip 会员，shop 商家，normal普通用户',
    required: true,
  })
  role: string;

  @IsString()
  @IsOptional()
  description: string;

  @IsNumber()
  @IsOptional()
  account: number;
}
